Skip to content

C#: Use feed management in the remaining restore flows. - #22041

Open
michaelnebel wants to merge 10 commits into
github:mainfrom
michaelnebel:csharp/morefeedmanageruses
Open

C#: Use feed management in the remaining restore flows.#22041
michaelnebel wants to merge 10 commits into
github:mainfrom
michaelnebel:csharp/morefeedmanageruses

Conversation

@michaelnebel

@michaelnebel michaelnebel commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The primary purpose of this PR is to use the newly introduced feed manager in more of the package restore flows.

To achieve this we are

  • Re-factoring a bit more functionality into the feed manager to avoid arguments being passed around in the NuGet package restorer.
  • Use the feed manager in DowloadMissingPackages. This also somewhat simplifies the restore logic as we no longer create a dedicated nuget.config file in fallback scenarios, but instead we supply feeds directly via the command line. Furthermore, if NuGet feed responsiveness checking is disabled we use all feeds when attempting to download missing packages (this will include private registries as well).
  • Use the feed manager in the TryRestore method, which can be used to restore individual packages. The logic has been changed slightly here compared to earlier as we will attempt to use the feeds detected in the source directory (instead of those in the temporary directory).

With the changes in this PR, all restore like flows specify the feeds directly via the command line (unless NuGet feed checking is disabled and no private registries are configured). That is, as a follow up we can attempt the remove the timeout fallback and instead just always use reachable feeds.

Testing

  • DCA looks good.
  • A QA run was made and can be seen here. Note, that this is only available internally, but making the link available for the review'er. The QA run appears to be uneventful.

@github-actions github-actions Bot added the C# label Jun 24, 2026
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch from 25ade27 to afe8f07 Compare June 24, 2026 10:58
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch 5 times, most recently from 29a859a to 036f75c Compare June 24, 2026 13:47
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch from 036f75c to 86fc08e Compare June 25, 2026 11:06
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch 3 times, most recently from 4690d92 to 6ee50ce Compare June 30, 2026 13:05
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch from 43aaec6 to fde527a Compare June 30, 2026 14:21
@michaelnebel michaelnebel changed the title C#: Improve package download logic. C#: Use feed management in the remaining restore flows. Jul 1, 2026
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch 2 times, most recently from bbc01c9 to b0eaf49 Compare July 17, 2026 13:19
@michaelnebel
michaelnebel force-pushed the csharp/morefeedmanageruses branch from b0eaf49 to a66f82e Compare August 11, 2026 11:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Centralizes NuGet feed selection in FeedManager across remaining C# dependency restore flows.

Changes:

  • Adds lazy feed discovery and reachability management.
  • Passes feeds directly to restore commands.
  • Removes fallback nuget.config generation.
Show a summary per file
File Description
2026-07-17-nuget-package-restore.md Documents restore changes.
Semmle.Extraction.Tests/DotNet.cs Updates restore argument tests.
PackagesConfigRestorer.cs Uses managed feed selection.
NugetPackageRestorer.cs Migrates remaining restore flows.
IDotNet.cs Removes config-path setting.
FeedManager.cs Centralizes feed state and reachability.
DotNet.cs Removes --configfile handling.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/NugetPackageRestorer.cs:324

  • The newly introduced unchecked-feed fallback is not exercised by the existing fallback integration tests; they all leave responsiveness checking enabled. Please add coverage that disables feed checking and verifies a missing package is restored through AllFeeds, including the intended configured/private-feed behavior.
            else
            {
                feeds = feedManager.AllFeeds;
            }
  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs Outdated
@michaelnebel
michaelnebel requested a review from hvitved August 13, 2026 07:55
@michaelnebel
michaelnebel marked this pull request as ready for review August 13, 2026 07:55
@michaelnebel
michaelnebel requested a review from a team as a code owner August 13, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants